package cn.wolfcode.wolf2w.common.redis.util;

import lombok.Getter;
/*
 * Redis key的工具类
 * */

@Getter
public enum RedisKeys {


    //枚举类
    QUESTION_ZAN("question_zan",-1l),//问答点赞标识
    BRUSH("brush",Consts.BRUSH_CODE_TIME*60l),
    ES_DATA("es_data",-1l),//同步es
    VERIFY_CODE("verify_code",Consts.VERIFY_CODE_TIME * 60l),
    STRATEGY_THUMBSUP("strategy_thumbsup",-1l),
    USER_STRATEGY_FAVOR("user_strategy_favor",-1l),
    STRATEGY_STATIS_INIT("strategy_statis_init",-1l),//攻略统计数据初始化标识
    STRATEGY_STATIS_HASH("strategy_statis_hash", -1l);//攻略统计数据

    private Long time;//过期时间
    private String prefix;//key的前缀

     RedisKeys(String prefix,Long time){
       this.time = time;
       this.prefix = prefix;
    }

    public String join(String... values){
        StringBuffer sb = new StringBuffer();
        sb.append(this.prefix);
        for (String value : values) {
            sb.append(":")
                    .append(value);
        }
        return sb.toString();
    }
}
